package cn.csc.module.shop.dal.mysql.hotsearch;

import java.util.*;

import cn.csc.framework.common.pojo.PageResult;
import cn.csc.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.csc.framework.mybatis.core.mapper.BaseMapperX;
import cn.csc.module.shop.dal.dataobject.hotsearch.ShopHotSearchDO;
import org.apache.ibatis.annotations.Mapper;
import cn.csc.module.shop.controller.admin.hotsearch.vo.*;

/**
 * 热搜 Mapper
 *
 * @author liuchuang
 */
@Mapper
public interface ShopHotSearchMapper extends BaseMapperX<ShopHotSearchDO> {

    default PageResult<ShopHotSearchDO> selectPage(ShopHotSearchPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ShopHotSearchDO>()
                .eqIfPresent(ShopHotSearchDO::getShopId, reqVO.getShopId())
                .eqIfPresent(ShopHotSearchDO::getContent, reqVO.getContent())
                .eqIfPresent(ShopHotSearchDO::getSeq, reqVO.getSeq())
                .eqIfPresent(ShopHotSearchDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ShopHotSearchDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(ShopHotSearchDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopHotSearchDO::getId));
    }

    default List<ShopHotSearchDO> selectList(ShopHotSearchExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<ShopHotSearchDO>()
                .eqIfPresent(ShopHotSearchDO::getShopId, reqVO.getShopId())
                .eqIfPresent(ShopHotSearchDO::getContent, reqVO.getContent())
                .eqIfPresent(ShopHotSearchDO::getSeq, reqVO.getSeq())
                .eqIfPresent(ShopHotSearchDO::getStatus, reqVO.getStatus())
                .eqIfPresent(ShopHotSearchDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(ShopHotSearchDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ShopHotSearchDO::getId));
    }

}
